<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<?php
	require_once('../includes/user.php');
	$user=new User();
	$cnt=1;
	$flag=1;
	if($_POST['test']==0)
	{
		$e_res=$user->query("select * from points where status=0 AND (type=21 OR type=22) ORDER BY history");
	}
	else
	{
		$e_res=$user->query("select * from points where status=0 AND type='$_POST[test]' ORDER BY history");
	}
	if(mysql_num_rows($e_res)>0)
	{
?>
<tr id="select_table">
  <td colspan="8" align="center" valign="middle" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9%" align="center" valign="middle">Select </td>
        <td width="8%" align="center" valign="middle"><span class="clickLink" onclick="selectAll()">All</span></td>
        <td width="7%" align="left" valign="middle"><span class="clickLink" onclick="selectNone()">None</span></td>
        <td width="19%" align="left" valign="middle"><span class="smartlink" onclick="selectedExtra(1)">Accept Selected</span></td>
        <td width="57%" align="left" valign="middle"><span class="smartlink" onclick="selectedExtra(2)">Reject Selected
        </span></td>
      </tr>
      </table>    </td>
  </tr>
<tr>
  <td colspan="8" align="center" valign="middle">&nbsp;</td>
  </tr>
<tr id="head_atten" class="head">
    <td align="center" valign="middle">&nbsp;</td>
    <td align="center" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">Name</td>
    <td align="center" valign="middle">Date</td>
    <td align="center" valign="middle">Event,College/Dept</td>
    <td align="center" valign="middle">Competition</td>
    <td align="center" valign="middle">Grade</td>
    <td align="center" valign="middle">Action</td>
  </tr>
<?php
		while($e_row=mysql_fetch_array($e_res))
		{
			$p_res=$user->query("select * from user_profile where id='$e_row[profileid]'");
			$p_row=mysql_fetch_array($p_res);
			if($_POST['year']==0)
			{
				$flag=2;
			?>
<tr>
  <td align="center" valign="middle">&nbsp;</td>
  <td align="left" valign="middle">&nbsp;</td>
  <td align="left" valign="middle">&nbsp;</td>
  <td align="center" valign="middle">&nbsp;</td>
  <td align="center" valign="middle">&nbsp;</td>
  <td align="center" valign="middle">&nbsp;</td>
  <td align="center" valign="middle">&nbsp;</td>
  <td align="center" valign="middle">&nbsp;</td>
</tr>
<tr>
            <td width="2%" align="center" valign="middle">
			<?php echo $cnt; ?>    </td>
    <td width="3%" align="left" valign="middle"><input type="checkbox" name="check<?php echo $cnt; ?>" id="check<?php echo $cnt; ?>" value="<?php echo $e_row['id']; ?>"></td>
    <td width="16%" align="left" valign="middle"><?php echo $p_row['name']; echo ' ('.$user->getYear($p_row['year']).' )';?></td>
    <td width="12%" align="center" valign="middle"><?php 
	$da=explode("-",$e_row['date']);
	echo $da[2].'/'.$da[1].'/'.$da[0]
 ?></td>
    <td width="17%" align="center" valign="middle"><?php 
if($e_row['type']==21){ echo $e_row['special1'].'(Intra)';}else{echo $e_row['special1'].'(Inter)'; } ?></td>
    <td width="15%" align="center" valign="middle"><?php echo $e_row['special2']; ?></td>
    <td width="13%" align="center" valign="middle"><?php
		if($e_row['special3']==0)
		{
			echo 'Participation';
		}
		else if($e_row['special3']==1)
		{
			echo 'First';
		}
		else if($e_row['special3']==2)
		{
			echo 'Second';
		}
		else if($e_row['special3']==3)
		{
			echo 'Third';
		}
	 ?></td>
    <td width="22%" align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><input type="image" src="img/buttons/accept.gif" onclick="induExtra(<?php echo $e_row['id']; ?>,3)" /></td>
        <td><input type="image" src="img/buttons/reject.gif" onclick="induExtra(<?php echo $e_row['id']; ?>,4)" /></td>
      </tr>
    </table>    </td>
</tr>
        	<?php
			}
			else if($_POST['year']!=0)
			{
				if($p_row['year']==$_POST['year'])
				{
					$flag=2;
				?>
        		<tr>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
          		<td>&nbsp;</td>
        		</tr>
  				<tr>
    			<td width="2%"><?php echo $cnt; ?></td>
    			<td width="3%"><input type="checkbox" name="check<?php echo $cnt; ?>" id="check<?php echo $cnt; ?>"></td>
                <td width="16%"><?php echo $p_row['name']; echo ' ('.$user->getYear($p_row['year']).' )';?></td>
                <td width="12%" align="center" valign="middle"><?php 
	$da=explode("-",$e_row['date']);
	echo $da[2].'/'.$da[1].'/'.$da[0]
 ?></td>
                <td width="17%" align="center" valign="middle"><?php 
if($e_row['type']==21){ echo $e_row['special1'].'(Intra)';}else{echo $e_row['special1'].'(Inter)'; } ?></td>
                <td width="15%" align="center" valign="middle"><?php echo $e_row['special2']; ?></td>
                <td width="13%" align="center" valign="middle"><?php
		if($e_row['special3']==0)
		{
			echo 'Participation';
		}
		else if($e_row['special3']==1)
		{
			echo 'First';
		}
		else if($e_row['special3']==2)
		{
			echo 'Second';
		}
		else if($e_row['special3']==3)
		{
			echo 'Third';
		}
	 ?></td>
                <td width="22%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><input type="image" src="img/buttons/accept.gif" onclick="induExtra(<?php echo $e_row['id']; ?>,3)" /></td>
                    <td><input type="image" src="img/buttons/reject.gif" onclick="induExtra(<?php echo $e_row['id']; ?>,4)" /></td>
                  </tr>
                </table></td>
              </tr>
            	<?php
				}
			}
			$cnt++;
		}
	}
	else
	{
		$flag=2;
?>
<div align="center">
	There are no pending requests in this category</div>
<?php
	} 
	if($flag==1)
	{
	?>

<tr>
<td colspan="8" align="center" valign="middle">There are no pending requests in this category
<script>
	$('#head_atten').hide();
	$('#select_table').hide();
</script></td>
</tr>
    <?php
	}
?>
<input type="hidden" value="<?php echo $cnt-1; ?>" id="no_req" />
</table>
